package com.helmlabs.grouper.accounts.utils;

import org.springframework.security.context.SecurityContextHolder;

import com.helmlabs.grouper.accounts.model.UserProfile;

public class AccountUtils {
	
	public static UserProfile getCurrentUser(){
		if (SecurityContextHolder.getContext()!=null){
			if (SecurityContextHolder.getContext().getAuthentication()!=null){
				UserProfile profile = (UserProfile)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
				return profile;
			}
		}
		return null;
	}

}
